/*
 * SmartCam master processor library
 * Miscellaneous management
 */

#include "globals.h"
#include <stdarg.h>

#ifdef __cplusplus
extern "C" {
#endif

void scManInit();
void scManReadMachines(char *file);
sc_var_t *scManFindVariable(void *address);
table_t scManArgDecode(char *format, va_list ap);
int scManIsVariableFinalized(sc_var_t *v);
int scManIsVariableDispatched(sc_var_t *v);
int scManIsVariableDestroyed(sc_var_t *v);
sc_instance_t *scManFindInstance(void *address);
sc_var_t *scManAddVariable(int type, int size);
sc_instance_t *scManAddInstance(sc_var_t *v, void *address);
sc_buf_t *scManAddBuffer(sc_var_t *v, sc_proc_t *p);
void *scManAddTemporary(int size);
void scManAcquireLock(void);
void scManShedLock(void);
void scManDump(void);
  void scManCheckDestroyTemporary(void *address);
void scManCheckDestroyArgument(sc_arg_t *a);
void scManCheckDestroyInstance(sc_instance_t *i);
void scManCheckDestroyVariable(sc_var_t *v);
void scManCheckDestroyOperation(sc_op_t *o);
void scManCheckDestroyBuffer(sc_buf_t *b);

void scManCreateOrigin(sc_var_t *v, int virtual);
void scManCheckReferenceOrigin(sc_var_t *v, sc_originref_t *r, int delay);
void scManReplaceOrigin(sc_origin_t *o, table_t *references);
void scManCheckDestroyOrigin(sc_origin_t *o);
//int scManGetDelay(int op);
sc_thread_t *scManAddThread(void);
void scManDestroyThread(void);
sc_thread_t *scManGetThread(void);
sc_op_t *scManInsertLoop(sc_var_t *v);

#ifdef __cplusplus
}
#endif
